package com.lorenzogao.pley.ui.base

import android.content.Intent
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import com.lorenzogao.pley.AppApplication
import com.lorenzogao.pley.ui.di.component.AppComponent
import com.lorenzogao.pley.ui.presenter.BasePresenter
import javax.inject.Inject

/**
 * 作者：Lorenzo Gao
 * Date: 2017/12/27
 * Time: 16:52
 * 邮箱：2508719070@qq.com
 * Description:
 */
open abstract class BaseActivity<T : BasePresenter<*,*>> : AppCompatActivity() {


    protected  lateinit var mApplication: AppApplication


    @Inject
    lateinit var mPresenter : T


    override fun onCreate(savedInstanceState: Bundle?) {

        super.onCreate(savedInstanceState)
        setContentView(setLayout())

        this.mApplication = application as AppApplication


        initData()

        initView()

        setupActivityComponent(mApplication.getAppComponent())

    }


    abstract fun setLayout(): Int

    abstract fun initData()

    abstract fun  initView()


    abstract fun setupActivityComponent(appComponent: AppComponent)

    protected fun JumAct(mClass: Class<*>) {
        this.startActivity(Intent(this, mClass))
    }


}